<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

namespace data\formats;

defined('ANS') or die();

class Email extends Formats implements iFormats {
	var $format = 'email';

	public function check ($value) {
		$this->error = array();

		if (!$this->validate($value)) {
			return false;
		}

		if ($value[''] && !filter_var($value[''], FILTER_VALIDATE_EMAIL)) {
			$this->error[''] = __('This is an invalid email');

			return false;
		}

		return true;
	}

	public function settings ($settings) {
		$this->settings = $this->setSettings($settings, array(
			'' => array(
				'db_type' => 'varchar',

				'length_max' => 100,
			)
		));

		return $this->settings;
	}
}
?>